package com.ts.enterprise.exception.check;

import com.ts.enterprise.exception.ExceptionEnum;
import lombok.Getter;
import lombok.Setter;

/**
 * 校验异常父类, 一般不直接抛出该异常, 而是指定具体的校验异常子类
 *
 * @author meng.yu
 * @date 2020/7/27
 */
@Getter
@Setter
public class CheckException extends RuntimeException {

    private int code;
    private String message;

    public CheckException() {
        super(ExceptionEnum.CHECK_EXCEPTION.getMsg());
        this.code = ExceptionEnum.CHECK_EXCEPTION.getCode();
        this.message = ExceptionEnum.CHECK_EXCEPTION.getMsg();
    }

    protected CheckException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }
}
